package com.zhuss.controller.team;

import com.zhuss.bean.bo.team.invest.CreateInvestBo;
import com.zhuss.bean.bo.team.invest.DeleteInvestBo;
import com.zhuss.bean.bo.team.invest.InvestQuestionBindBo;
import com.zhuss.bean.bo.team.invest.UpdateInvestBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.exception.WpsException;
import com.zhuss.team.db.entity.InvestQuestion;
import com.zhuss.team.invest.InvestOperateServiceExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: zhushanshuo
 * @Date: 2020/3/26 11:07
 */
@RestController
@RequestMapping("/invest")
public class InvestOperateController extends BaseController {

    @Autowired
    @Qualifier("investOperateService")
    private OperateService<Void, Object> investOperateService;

    @Autowired
    @Qualifier("investOperateServiceExt")
    private InvestOperateServiceExt investOperateServiceExt;

    /**
     * 新建
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateInvestBo bo) throws WpsException {
        investOperateService.create(bo);
    }

    /**
     * 修改
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateInvestBo bo) throws WpsException {
        investOperateService.update(bo);
    }

    /**
     * 删除
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteInvestBo bo) throws WpsException {
        investOperateService.delete(bo);
    }

    /**
     * 给问卷绑定问题
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @PostMapping("/investQuestionBind")
    public void investQuestionBind(@RequestBody InvestQuestionBindBo bo) throws WpsException {
        investOperateServiceExt.investQuestionBind(bo);
    }
}
